package javagame;

import java.util.Random;

/**
 * @author Sabre Runner
 *
 */
public class Apple implements Runnable
{
	String name;
	Integer time;
	Random r = new Random();
	
	// TODO Write constructor
	public Apple(String s)
	{
		name = s;
		time = new Integer(r.nextInt(999));
	}

	/* (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run()
	{
		try
		{
			System.out.printf("%s is sleeping for %d\n", name, time);
			Thread.sleep(time.longValue());
			System.out.printf("%s is done.\n", name);
		} 
		catch (Exception exception)
		{
			
		}
	}
}
